import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
  server: {
    port: 3308,
    strictPort: true, // 如果端口被占用，不会自动切换到其他端口
    proxy: {
      '/api': {
        target: 'http://localhost:8858',  // 指向Java后端
        changeOrigin: true,
        rewrite: (path) => path  // 保持/api路径
      }
    }
  }
})

